$(function () {
    twModeFn();

    $('body').on('click', '#freeToQuestion', function () {//去免费提问
        freeToQuestion();
    }).on('click','#noFreeToQuestion',function () {//去付费提问（讲师列表）
        $.ajax({
            url: baseloaction + "/web/teacher/isQuestion",
            type:"post",
            dataType:"json",
            success:function (result) {
                if(result.success){
                    if(result.entity){
                        window.location.href = baseloaction + '/web/teacher/list?isQuestionOrder=1';
                    }else{
                        icModale(0,"","平台暂无付费回答的讲师，后续敬请期待，建议体验免费提问！");
                    }
                }else {
                    icModale(0,"","系统繁忙，请稍后重试");
                }
            },
            error:function (error) {
                icModale(0,"","系统繁忙，请稍后重试");
            }
        });

    });
})
/**
 * 问答广场获取右侧页面公共js
 */
function getRightView() {
    getPageAjaxData({
        url: baseloaction + '/web/qa/getRightContent',
        contextId: 'right-context',
        callback : function() {
            $('[data-toggle=tooltip]').tooltip();
        }
    })
}

/**
 * 提问弹出框
 */
function twModeFn() {
    var _ele = $('#ele-twMode-bx').val()
    $('body').on('click', '#goQuestionBtn', function() {
        layer.open({
            type: 1,
            title: false,
            area: '580px',
            closeBtn: 0,
            shadeClose: true,
            skin: 'lay_ppComment__wrap',
            content: _ele
        })
    })
}

function freeToQuestion() {
    isLogin(function () {
        window.location.href = baseloaction + "/web/uc/qa/initSaveQuestionView?type=1";
    });
}